{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4588d15b-f82e-4287-a31c-fb3866c17261",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入直角三角形的直角边A(>0)：    3\n",
      "请输入直角三角形的直角边B(>0)：    4\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "直角三角形三边分别为： a=3.0, b=4.0, c=5.0\n",
      "三角形的周长 = 12.0，面积 = 6.0\n",
      "三角形两个锐角的度数分别为： 37.0 和 53.0\n"
     ]
    }
   ],
   "source": [
    "from math import *\n",
    "a=float(input(\"请输入直角三角形的直角边A(>0)：   \"))#直角边A\n",
    "b=float(input(\"请输入直角三角形的直角边B(>0)：   \"))#直角边B \n",
    "c = sqrt(pow(a, 2) + pow(b, 2))#斜边C\n",
    "print(str.format(\"直角三角形三边分别为： a={0:1.1f}, b={1:1.1f}, c={2:1.1f}\", a, b, c))\n",
    "p = a + b + c   #周长\n",
    "h = p / 2\n",
    "area = sqrt(h * (h - a) * (h - b) * (h - c)) #面积\n",
    "print(str.format(\"三角形的周长 = {0:1.1f}，面积 = {1:1.1f}\", p, area)) #显示周长和面积\n",
    "sinA = a / c\n",
    "aAngle = round(asin(sinA) * 180 / pi, 0)#锐角A\n",
    "cosB = a / c\n",
    "bAngle = round(acos(sinA) * 180 / pi, 0)#锐角B\n",
    "print(str.format(\"三角形两个锐角的度数分别为： {0:1.1f} 和 {1:1.1f}\", aAngle, bAngle))\n",
    "input()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f593ab56-9a76-4767-85e2-e92167668d20",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
